]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: always coerce the SSID to _something_
authorRui Matos <tiagomatos@gmail.com>
Wed, 3 Aug 2011 18:05:53 +0000 (19:05 +0100)
committerRui Matos <tiagomatos@gmail.com>
Fri, 12 Aug 2011 16:26:54 +0000 (17:26 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=654898

js/ui/status/network.js

index 341f9b0e82e48bac3005bb4f431135f8602e92e2..3f38062293e0d3482bda7695975670a380880f8c 100644 (file)
@@ -102,6 +102,13 @@ function sortAccessPoints(accessPoints) {
     });
 }
 
+function ssidToLabel(ssid) {
+    let label = NetworkManager.utils_ssid_to_utf8(ssid);
+    if (!label)
+        label = _("<unknown>");
+    return label;
+}
+
 function NMNetworkMenuItem() {
     this._init.apply(this, arguments);
 }
@@ -117,10 +124,7 @@ NMNetworkMenuItem.prototype = {
 
         if (!title) {
             let ssid = this.bestAP.get_ssid();
-            if (ssid)
-                title = NetworkManager.utils_ssid_to_utf8(ssid);
-            if (!title)
-                title = _("<unknown>");
+            title = ssidToLabel(ssid);
         }
 
         this._label = new St.Label({ text: title });
@@ -1002,7 +1006,7 @@ NMDeviceWireless.prototype = {
                         item: null,
                         accessPoints: [ ap ]
                       };
-                obj.ssidText = NetworkManager.utils_ssid_to_utf8(obj.ssid);
+                obj.ssidText = ssidToLabel(obj.ssid);
                 this._networks.push(obj);
             }
 
@@ -1219,7 +1223,7 @@ NMDeviceWireless.prototype = {
                       item: null,
                       accessPoints: [ accessPoint ]
                     };
-            apObj.ssidText = NetworkManager.utils_ssid_to_utf8(apObj.ssid);
+            apObj.ssidText = ssidToLabel(apObj.ssid);
             needsupdate = true;
         }